/* 超时连接测试1：创建一个客户端，给服务器发送一次数据后，不动了，查看服务器是否会正常的超时关闭连接 */

#include "../source/server.hpp"

int main()
{
    Socket client_sock;
    client_sock.CreateClient(8080, "127.0.0.1");

    std::string req = "GET /hello HTTP/1.1\r\nConnection: keep-alive\r\nContent-Length: 0\r\n\r\n";
    while(true) {
        int ret = client_sock.Send(req.c_str(), req.size());
        if(ret < 0) break;
        char buf[1024] = { 0 };
        ret = client_sock.Recv(buf, sizeof(buf) - 1);
        if(ret < 0) break;
        LOG(LogLevel::DEBUG) << buf;
        sleep(15);
    }

    client_sock.Close();

    return 0;
}